#ifndef XLSREADER_H
#define XLSREADER_H
#import "msado15.dll" no_namespace rename("EOF", "adoEOF") rename("BOF", "adoBOF")
#include <string>

class XlsReader
{
public:
    XlsReader( );
    ~XlsReader( );
    int GetInt32Value( std::string valuename, int defaultvalue = 0 );
    std::string GetStringValue( std::string valuename,std::string defaultvalue = "" );
    float GetFloatValue( std::string valuename, float defaultvalue = 0.0f );
    bool Eof( );
    bool LoadXlsSheet( std::string name, std::string sheetname, bool header = true );
    bool NextRow( );

protected:
    _variant_t *GetValue( std::string valuename );
    std::string makeConnStr(std::string filename, bool header = true);
    bool HasSheet(std::string sheetname);
    inline void TESTHR(HRESULT x) 
    {
        if FAILED(x) _com_issue_error(x);
    }
    void CleanUp( );

    _RecordsetPtr m_pRecord;
    _RecordsetPtr m_pSchema;
    _ConnectionPtr m_pConnection;
};


#endif